<template>
	<view class="searchs">
		<div>
			<navitop>
				<i class="iconfont" slot="left-slot" @click="outlot">&#xe667;</i>
				<span slot="center-slot">搜索条件删除</span>
				<!-- <i class="iconfont icon-youcecaidan" slot="right-slot"  @click="tapPopup"></i> -->
			</navitop>
		</div>
		<div style="margin-top: 30%;"></div>
		<div class="search_del">
			<div class="search_class" v-for="(item,index) in dataSorce" @click="delet(item.id)">
				<div class="search_del_out">
					<i class="iconfont icon-x"></i>
				</div>
				<div class="search_icon">
					<i class="iconfont icon-nb-"></i><br>
				</div>
				<div class="search_txt">
					{{item.searchName}}
				</div>
			</div>
		</div>
		
	</view>
</template>
<script>
	import navitop from '@/components/common/navi-top'
	import {Searchdetail,Searchdelete} from '@/common/api/job/jobapi.js'
	export default {
		components: {
			navitop
		},
		data() {
			return {
				dataSorce: ''
			}
		},
		onLoad(option) {
			// 获取键盘高度
			console.log(option)
			// 获取分类参数
				this.crmTypes = option.crmType,
				this.names = option.name,
				this.uid = option.id,
				this.url = '?id=' + this.uid + '&crmType=' + this.crmTypes + '&name=' + this.names;
		
			this.serCh_list(this.crmTypes)
		},
		mounted() {
		},
		methods: {
			outlot(){
				uni.navigateTo({
					url: '/pages/common/common/serarch/search' + this.url
				})
			},
			serCh_list(val){
				Searchdetail({searchType:val}).then((rows) =>{
					if(rows.code == 200){
						console.log(rows.data)
						this.dataSorce = rows.data;
					}
				})
			},
			
			//删除联系
			delet(val) {
				let _this = this;
				if (this.sarch_class_id == '') {
					uni.showToast({
						title: '请选择需要删除的数据',
						iron: 'error'
					})
					return false;
				}
				uni.showModal({
					title: '提示',
					content: '确定要删除吗？',
					success: function(res) {
						uni.showLoading({
							title: '删除中'
						});
						if (res.confirm) {
							Searchdelete({
								id: val
							}).then((rows) => {
								if (rows.code == 200) {
									uni.hideLoading();
									uni.showToast({
										title: '删除成功'
									})
									setTimeout(() => {
										location.reload();
									}, 1500)
								}
							})
						} else if (res.cancel) {
							uni.hideLoading();
							console.log('用户取消')
						}
					}
				})
			},
			
		}
			
	}
</script>
<style scoped lang="scss">
	.searchs {
		height: 100%;
		width: 100%;
		background-color: #fff;
		.search_del {
			width: 95%;
			margin: auto;
			display: flex;
			flex-wrap: wrap;
			padding: 0 0 0 20rpx;
			.search_class {
				margin: 15rpx;
				width: 20%;
				height: 100px;
				overflow: hidden;
				text-align: center;
				border: 1px solid #cacaca;
				border-radius: 4px;
				.search_del_out {
					width: 15px;
					height: 15px;
					float: right;
					margin-right: 7px;
					i {
						color: #cacaca;
						border: 2px solid #cacaca;
					}
				}
				.search_icon {
					color: #1890FF;
					padding: 15px 0 0 0;
					i {
						font-size: 30px;
					}
				}
			}
		}
	}
</style>
